package com.controller;

import com.pojo.Result;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * 用户权限
 * @author lifeng
 * @create 2022-11-20 22:15
 */
@RestController
@RequestMapping("/userPermission")
public class UserPermissionController {

    /**
     * 用户登录
     * {"code":20000,"data":{"token":"admin-token LeeTonyStark"}}
     * @return
     */
    //@PostMapping("/login")
    public Result login(){
        HashMap<String, Object> map = new HashMap<>();
        Result result = new Result();
        map.put("token","admin-token");
        result.setCode(200);
        result.setData(map);
        return result;
    }

    /**
     * 登录详情
     * {"code":20000,"data":{"roles":["admin"],
     * "introduction":"I am a super administrator",
     * "avatar":"https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif",
     * "name":"Super Admin LeeTonyStark"}}
     * @return
     */
   // @GetMapping("/info")
    public Result info(){
        Result result = new Result();
        result.setCode(200);
        result.setMsg("/查询成功");
        HashMap<String, Object> map = new HashMap<>();
        map.put("roles","[admin]");
        map.put("introduction","I am a super administrator");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        map.put("name","Super Admin");
        result.setData(map);
        return result;
    }

}
